package com.demo.small_tool.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import com.demo.small_tool.response.Resp;

@RequestMapping("/log")
@RestController
@Slf4j
public class LogController {

    /**
     * 测试日志输出接口
     * @param msg 日志内容
     * @return 操作结果
     */
    @GetMapping("/test")
    public Resp<String> testLog(@RequestParam(defaultValue = "这是测试日志") String msg){
        log.debug("debug: {}", msg);
        log.info("info: {}", msg);
        log.warn("warn: {}", msg);
        log.error("error: {}", msg);
        return Resp.success("200", "日志输出成功", msg);
    }
}
